Public Class CarrerasGrid


    Private Sub mnuAgregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAgregar.Click

        carreras_list = New CarrerasCollection()
        DataGridView1.DataSource = carreras_list

        CarrerasForm.operacion = "Alta"

        CarrerasForm.Show()
    End Sub

    Private Sub mnuEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEliminar.Click
        CarrerasForm.operacion = "Elimina"
        CarrerasForm.indice = DataGridView1.CurrentRow.Index

        LlenarForm1()

        CarrerasForm.Show()
    End Sub

    Private Sub mnuEditar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditar.Click
        CarrerasForm.operacion = "Modifica"
        CarrerasForm.indice = DataGridView1.CurrentRow.Index

        LlenarForm1()

        CarrerasForm.Show()
    End Sub

    Private Sub mnuSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSalir.Click
        Me.Close()
    End Sub

    Private Sub llenarform1()
        CarrerasForm.TextBox1.Text = DataGridView1.CurrentRow.Cells(0).Value.ToString
        CarrerasForm.TextBox2.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString
        CarrerasForm.ComboBox1.SelectedIndex = DataGridView1.CurrentRow.Cells(2).Value - 1
    End Sub

    Private Sub CarrerasGrid_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        DataGridView1.DataSource = carreras_list
    End Sub
End Class